var app = getApp();
// pages/waterParameter/waterParameter.js 
var redg=-1080;
Page({

  /**
   * 页面的初始数据
   */
  data: {
    animation_data:'',//放置动画盒子
    de_status:[],
    d_Info:[],
    de_parm:[],
    eq_sn: '',
    loadShow:true,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      eq_sn: options.eq_sn
    })
    //this.deviceInfo();
    //this.device_status();
    this.device_Param();
  },
  deviceInfo() {
    var that = this;
    app.ajax({
      url: 'Manage/Equipment/deviceInfo',
      data: {
        sn: that.data.eq_sn,
      },
      success: function (res) {
        if (res.data.code == 1000) {
          that.setData({
            d_Info: res.data.data
          })
        } else {
          app.showToast(res.data.message);
        }
      }
    })
  },
  device_Param() {
    var that = this;
    app.ajax({
      url: 'Manage/Equipment/getDeviceParam',
      data: {
        sn: that.data.eq_sn,
      },
      success: function (res) {
        if (res.data.code == 1000) {
          
          that.setData({
            de_parm: res.data.data,            
          })
        } else {
          app.showToast(res.data.message);
        }
        that.setData({ loadShow:false})
      }
    })
  },
  device_status() {
    var that = this;
    app.ajax({
      url: 'Manage/Equipment/device_status',
      data: {
        sn: that.data.eq_sn,
      },
      success: function (res) {
        if (res.data.code == 1000) {
          that.setData({
            de_status: res.data.data,
          });
        } else {
          app.showToast(res.data.message);
        }
      }
    })
  },


  //刷新按钮
  upDataBtn:function(){
    var animation = wx.createAnimation({
      duration: 1000,
      timingFunction: 'ease',
      success: function (res) {
        console.log("动画结束")
      }
    })
    if (redg) {
      redg -= 1080;
    }
    this.animation = animation
    animation.rotate(redg).step()
    this.setData({
      animation_data: animation.export()
    })
  }
})